/**
 * 思想， 分别对比左右两个树， 看看是不是一样的
 * @param T
 * @returns {*}
 */
function balanceTree(T) {
    if(!T) return true
    return F(T.left, T.right)

    function F(left, right) {
        if(!left && !right) return true
        if(left || !right) return false
        if(left.val === right.val) {
            return F(left.left , right.right) && F(left.right , right.left)
        }
        return false
    }
}


function isBalanceTree(T){
    if(!T) return true
     F(T.left, T.right)

    function F(left, right) {
        if(!left && !right) return true
        if(!left || !right) return false
        if(left.val=== right.val){
            return F(left.left, right.right) && F(left.right, right.left)
        }
        return false
    }
}
